{extend name="../../base/view/layout" /}
{block name="my_body"}
<div class="maincontent">
    <div class="maincontentinner">

        <table id="dyntable" class="table table-bordered responsive">
            <thead>
            <tr>
                <th class="center"><input type="checkbox" class="checkall" /></th>
                <th class="center">ID</th>
                <th class="center">相册名称</th>
                <th class="center">缩略图</th>
                <th class="center">操作</th>
            </tr>
            </thead>
            <tbody>
            <?php foreach($data as $v):?>
            <tr >
                <td class="aligncenter"><span class="center">
                            <input type="checkbox" />
                          </span></td>
                <td class="center"><?php echo $v['id'];?></td>
                <td class="center"><?php echo $v['album_name'];?></td>
                <td class="center"><?php showImage($v['small_pic'],30,30);?></td>
                <td class="center"> <a thisid="<?php echo $v['id'];?>" href="javascript:;" onclick="del(this)">删除</a></td>
            </tr>
            <?php endforeach;?>

            </tbody>
        </table>

        <br /><br />

        <?php echo $page;?>

    </div><!--maincontentinner-->
</div><!--maincontent-->
{/block}

{block name="my_js"}
<script>
    function del(t)
    {
        var id = jQuery(t).attr('thisid');
        var url = "<?php echo url('del');?>";
                jQuery.ajax({
                    type: 'POST',
                    url: url,
                    data:"id="+id,
                    dataType: 'JSON',
                    success: function(res){
                        if(res.code == 0)
                        {
                            jQuery(t).parent().parent().remove();
                        }
                        else
                        {
                            var html = '<div class="widgetbox box-danger"><h4 class="widgettitle">错误提示 <a class="close">×</a> <a class="minimize">–</a></h4><div class="widgetcontent">'+res.msg+'</div></div>';
                            var h = jQuery(html);
                            jQuery(".maincontentinner").prepend(h);
                            window.setTimeout(function(){
                                h.remove();
                            },1000);
                        }
                    }
                })
    }
</script>
{/block}
